<?php require ("header.php"); ?>
<?php
	if ($ad_check<1){
			header ("Location:../login.php?action=0");
	}

	$sql_ad_dep="SELECT * FROM admin WHERE ad_no='$id'";
	$get_ad_dep=mysql_query($sql_ad_dep);
	$ad_info=mysql_fetch_assoc($get_ad_dep);
	
	$sql_get_dep="SELECT * FROM deparment";
	$get_dep=mysql_query($sql_get_dep);
?>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
}
.style1 {
	font-size: 16px;
	font-weight: bold;
	color: #0099FF;
}
.style3 {color: #000000}
.style4 {color: #FF0000}
-->
</style>
<form name="update_profile" method="POST" action="engine/update_profile.php">
<table width="780" border="0" align="center">
  <tr>
    <td width="216">&nbsp;</td>
    <td width="5">&nbsp;</td>
    <td width="545">&nbsp;</td>
  </tr>
  <tr bgcolor="#666666">
    <td colspan="3"><div align="center" class="style1"><?php echo "<font color=\"white\">".strtoupper($who). "</font> "; ?>PROFILE</div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><span class="style3">Name</span></td>
    <td><span class="style3">:</span></td>
    <td><input name="ad_name" type="text" value="<?php echo $ad_info['ad_name']; ?>" size="50"> </td>
  </tr>
  <tr>
    <td><span class="style3">Staff ID </span></td>
    <td><span class="style3">:</span></td>
    <td><span class="style3">
      <input name="ad_no" type="text" id="ad_no" value="<?php echo $ad_info['ad_no']; ?>" readonly="true" />
      *<span class="style4"> Cannot change staff id </span></span></td>
  </tr>
  <tr>
    <td colspan="3"><hr></td>
  </tr>
  <tr>
    <td><span class="style3">New Password</span></td>
    <td><span class="style3">:</span></td>
    <td><input name="ad_password1" type="password" id="ad_password1" size="30"></td>
  </tr>
  <tr>
    <td><span class="style3">Confirm New Password </span></td>
    <td><span class="style3">:</span></td>
    <td><input name="ad_password2" type="password" id="ad_password2" size="30"></td>
  </tr>
  <tr>
    <td colspan="3"><hr></td>
  </tr>
  <tr>
    <td><span class="style3">Department</span></td>
    <td><span class="style3">:</span></td>
    <td><span class="style3">
      <select name="ad_department" id="ad_department">
        <?php 
		
		while ($row = mysql_fetch_assoc($get_dep)) {
			$a="";
			if ($row['dep_code']==$ad_info['ad_department']) {
				$a="selected";
			} ?>
        <option value="<?php echo $row['dep_code']; ?>" <?php echo $a; ?>><?php echo $row['dep_name']; ?></option>
        <?php } ?>
      </select>
    </span> </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#666666">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3"><div align="center">
      <input type="submit" name="Submit" value="Update Profile">
    </div></td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
</table>
</form>

<?php require ("footer.php"); ?>